package dao.impl;

import bean.Student;
import bean.User;
import dao.UserDao;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.SqlOutParameter;

public class UserDaoImpl implements UserDao {
    private JdbcTemplate jdbcTemplate;
    public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }
    public User login(User user)throws EmptyResultDataAccessException
    {
        user=jdbcTemplate.queryForObject("select * from user where id=? and pwd=?",new BeanPropertyRowMapper<User>(User.class),user.getId(), user.getPwd());
        return user;
    }
}
